<?php

// 4/2/2010: immanuel192 write this action for send mailinglist page

if (!defined('EXPONENT')) exit('');
global $db;
if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
if (exponent_permissions_check(array("administrate", "mail"),$loc)) {

	exponent_forms_initialize();
	$form = new form();

	$form->register('subject','Subject',new textcontrol("",45));	
	$form->register('content','Mailing-list Content',new htmleditorcontrol());
    $form->register("", null, new htmlcontrol("<p>You can use %name% for Name of receiver.</p>"));
    
    // Nov 6, 2011 - trungdt - Add : whom will we send email to
    $temp=array(0=>"Mailling List Registered", 1=>"All normal user", 2=>"All user",3=>"Register(not user)",4=>"Register(both user and non user)");
    $form->register("send_type", "Receivers", new dropdowncontrol(0,$temp));
    
	$form->register('submit','',new buttongroupcontrol('Send','','Cancel'));

	$form->location($loc);
	$form->meta('action','send1');
	$form->meta('module','mailinglistmodule');
	$template = new template('mailinglistmodule','_send_mailinglist');
	$template->assign('form_html',$form->toHTML());
	$template->register_permissions(array("administrate","mail"),$loc);
	exponent_flow_set(SYS_FLOW_PROTECTED,SYS_FLOW_ACTION);
	$template->output();
}
else
	{
	echo SITE_404_HTML;	
	}
?>
